package com.grades.springboot.controller;

import com.grades.springboot.entity.Result;
import com.grades.springboot.service.impl.LoginServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private LoginServiceImpl loginService;

    @PostMapping("/loginById")
    public Result<?> loginById(Integer id,String password,String code,String userType, HttpServletRequest request){
//        System.out.println(id + code);
        return loginService.loginById(id,password,code,userType,request);
    }

    @PostMapping("/loginByEmail")
    public Result<?> loginByEmail(String email,String code,String userType){
        return loginService.loginByEmail(email,code,userType);
    }
}
